package com.ruoyi.shop.domain;

import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 优惠券领取记录对象 shop_coupon_code
 * 
 * @author Alan Zhang
 * @date 2021-09-14
 */
public class ShopCouponCode extends BaseEntity
{
    private static final long serialVersionUID = 1L;
    //该优惠码已经有人领取，并且可以正常使用
    public static final int STATUS_NORMAL = 1;

    //该优惠码未有人领取，不能被使用
    public static final int STATUS_UNCLAIMED = 2;

    //该优惠码已经有人领取，同时已经使用，不能再使用
    public static final int STATUS_USED = 3;

    //该优惠码已经被标识为不可使用
    public static final int STATUS_INVALID = 9;


    public boolean isNormal() {
        Integer status = getStatus();
        return status != null && status == STATUS_NORMAL;
    }
    /** 优惠券码id */
    private Long id;

    /** 类型ID */
    @Excel(name = "类型ID")
    private Long couponId;
    /** 类型 1满减券  2叠加满减券  3无门槛券 */
    @Excel(name = "类型 1满减券  2叠加满减券  3无门槛券")
    private Integer type;

    /** 满多少金额 */
    @Excel(name = "满多少金额")
    private BigDecimal withAmount;

    /** 优惠券金额 */
    @Excel(name = "优惠券金额")
    private BigDecimal amount;

    /** 优惠券标题 */
    @Excel(name = "优惠券标题")
    private String title;

    /** 优惠码 */
    @Excel(name = "优惠码")
    private String code;

    /** 用户ID */
    @Excel(name = "用户ID")
    private Long userId;

    /** 状态 1 有人领取、正常使用  2 未有人领取不能使用  3 已经使用，不能被再次使用  9 已经被认为标识不可用 */
    @Excel(name = "状态")
    private Integer status;

    /** 领取时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Excel(name = "领取时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    private Date validTime;

    private ShopCoupon shopCoupon;

    public void setId(Long id) 
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }
    public void setCouponId(Long couponId) 
    {
        this.couponId = couponId;
    }

    public Long getCouponId() 
    {
        return couponId;
    }
    public void setType(Integer type)
    {
        this.type = type;
    }

    public Integer getType()
    {
        return type;
    }
    public void setWithAmount(BigDecimal withAmount)
    {
        this.withAmount = withAmount;
    }

    public BigDecimal getWithAmount()
    {
        return withAmount;
    }
    public void setAmount(BigDecimal amount)
    {
        this.amount = amount;
    }

    public BigDecimal getAmount()
    {
        return amount;
    }
    public void setTitle(String title) 
    {
        this.title = title;
    }

    public String getTitle() 
    {
        return title;
    }
    public void setCode(String code) 
    {
        this.code = code;
    }

    public String getCode() 
    {
        return code;
    }
    public void setUserId(Long userId) 
    {
        this.userId = userId;
    }

    public Long getUserId() 
    {
        return userId;
    }
    public void setStatus(Integer status) 
    {
        this.status = status;
    }

    public Integer getStatus() 
    {
        return status;
    }
    public void setValidTime(Date validTime) 
    {
        this.validTime = validTime;
    }

    public Date getValidTime() 
    {
        return validTime;
    }

    public ShopCoupon getShopCoupon() {
        return shopCoupon;
    }

    public void setShopCoupon(ShopCoupon shopCoupon) {
        this.shopCoupon = shopCoupon;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("couponId", getCouponId())
            .append("type", getType())
            .append("withAmount", getWithAmount())
            .append("amount", getAmount())
            .append("title", getTitle())
            .append("code", getCode())
            .append("userId", getUserId())
            .append("status", getStatus())
            .append("validTime", getValidTime())
            .append("createTime", getCreateTime())
            .toString();
    }
}
